This page last changed on Jun 19, 2008.


This page collects the following related topics on a single HTML page:

This arrangement is designed to facilitate printing of the entire topic. Some duplication of references, link headers, and "Related Topics" information may be observe.

edocs Home > BEA AquaLogic Data Services Platform 3.0/3.2/3.01 Documentation

Authors
Scott Cranton,
John Jerney
Version
ALDSP 3.2 / 3.01

How To Support LDAP Server Entries Through Data Services

Prefer all related topics on a single page? Click here.

AquaLogic Data Services Platform (ALDSP) enables you to create physical data services based on Java functions. The example described in this topic focuses on creating a physical data service based on a set of functions that can access and update entries in an LDAP server.

Specifically, the example:

  • Shows how to build and test a sample application configured to work, by default, with the LDAP server embedded in WebLogic server.
  • Provides step-by-step instructions for creating the physical data service based on the Java functions.
  • Shows how to create an operation in a logical data service to test the physical data service against the embedded LDAP server. 

Topic Map

Exploring the Sample Application

The sample application, located in the DspLdapWrapper.java file, contains the following Java functions that you can use to create corresponding operations in a physical data service:

Java Function Description
createPerson()
Create an entity for a person on the LDAP server.
deletePerson()
Remove a person from the LDAP server.
getAllPersons()
Retrieve all persons in the LDAP server.
getPersonByUserId()
Retrieve a record from the LDAP server identified by the specific ID.
updatePersonSDO()
Update a record on the LDAP service using SDO.
updatePersonXMLBean()
Update a record on the LDAP service using XMLBeans.

Working with the Sample Application

 Working with the sample application to create the physical data service involves the following steps:

  1. Create the sample application.
    This involves setting up your Ant environment, editing the build.properties file, configuring the WebLogic embedded LDAP server, and building the Java application.
    See Building a Java LDAP Application for step-by-step instructions on how to create the sample application.
  2. Create the physical data service based on the Java functions in the sample application.

    See Creating the Physical Data Service for the LDAP Sample for details about how to create the physical data service using the sample application.

Related Topics

How Tos

edocs Home > BEA AquaLogic Data Services Platform 3.0/3.2 Documentation > ALDSP 3.2 New Features Documentation

How To Build a Java LDAP Application

This topic describes how to build the LDAP sample Java application, ldap_java.jar. The functions in the application can then be used as the basis for a data service.


Topic Map


Supporting LDAP Server Entries Through Data Services

Preparing to Build the Sample Application

In order to run this sample you must have ALDSP 3.2 or 3.01 installed and have downloaded and opened the LDAP sample file. The file can be obtained at:

http://edocs.bea.com/aldsp/docs30/code/LdapJavaDsp32.zip

  1. Download the file.
  2. Unzip to a local directory.

Editing the build.properties File

If your BEA_HOME is different than

C:\bea

you will need to modify the build.properties file located in the LdapJavaDsp32 directory to specify the location of the BEA home directory.

  1. Open the build.properties file.
  2. Modify the bea.home property to specify your BEA home directory.
    The default setting is:
    bea.home=C:\bea
  3. If necessary, change the setting to correspond with the location of your BEA_HOME.
  4. Save your file.

Setting the Embedded LDAP Server Credentials

You need to set the credentials for the embedded LDAP server to match the password configured for the sample application.

To configure the LDAP server credentials:

  1. Start the ALDSP-enabled WebLogic Server (10.0 MP1 or 9.2).
  2. Using a web browser, launch the WebLogic Server Console by navigating to the following URL:
  3. Click Lock & Edit in the Change Center of the Administration Console.
  4. In the left pane, click the name of the domain you are configuring (for example, aldsp).
  5. Select Security > Embedded LDAP.

    WebLogic Console - Embedded LDAP Security Settings

  6. Type the following value in the Credential and Confirm Credential fields:
    secret
  7. Click Save > Activate Changes
    The Activate Changes option is only active if you are changing the default credential password.
  8. Restart your ALDSP server.



    Configuring the Sample Application to Use an Alternative LDAP Server

    The sample application is configured to use the WebLogic embedded LDAP server. You can, however, use the sample application with any LDAP server that has a Distinguished Name (DN) with a list of inetOrgPerson instances.
    To configure the sample application to use an alternative LDAP server:

              1. Open the springldap.xml file.
                You can find the springldap.xml file in the following directory:
                <_LDAP-sample-app-dir_>/src/com/example/ldap/springldap.xml
              2. Edit the following values:
                Property
                Element
                url <property name="url" value="ldap://localhost:7001" />
                base <property name="base" value="dc=aldsp" />
                userName <property name="userName" value="cn=Admin" />
                password
                <property name="password" value="secret" />
              3. Save the file.

Building the Sample Application

The next step involves building the sample application, including the Java Spring LDAP classes.

In a terminal window set up the Ant environment by running the following command:

<WEBLOGIC_HOME>/server/bin/setWLSEnv.cmd

To build the sample application:

  1. Navigate to the root directory where you placed the LdapJavaDsp32 sample.
  2. Run:
ant dist

This builds the Java Spring LDAP classes.

Building the Sample Application Using Ant

Testing the Sample Application

You can test the sample application against the LDAP server.

To test the sample application run the following command to test the Java Spring LDAP classes:

ant test-app

You should see output similar to that shown in the following screen capture.

Running the Sample Application Using Ant

Next Step

Related Topics

Concepts
How Tos

edocs Home > BEA AquaLogic Data Services Platform 3.0/3.2 Documentation > ALDSP 3.2 New Features Documentation

How To Create the Physical Data Service for the LDAP Sample

This topic describes how to create a physical data service based on the LDAP sample application.

Topic Map

Supporting LDAP Server Entries Through Data Services

Installing the ALDSP Retail Dataspace Sample

  1. If it is not already running, launch Studio.
  2. If you have not already done so, install the ALDSP Retail Dataspace Sample. The sample creates a dataspace for retail data services that connects to a relational database and web services.
    Depending on whether your are running WebLogic server 10.1 or 9.2 see:

Importing JAR Files

Two separate import operations into the Retail Dataspace project are needed.

Import Source Contents
Spring LDAP 1.2.1 JAR Basic LDAP support classes.
ldap_java.jar Java functions needed by the new physical data service.

If you have not already done so, unzip the project ZIP file LdapJavaDsp32.zip into a temporary directory. The project files are located in the LdapJavaDsp32 directory.

Importing Spring LDAP JAR Files 

To import the Spring LDAP JAR files which were included with the LDAP sample:

  1. Expand the Retail Dataspace project and locate the DSP-INF/lib folder.

    Project Explorer - DSP-INF/lib Folder

  2. Right-click the DSP-INF/lib folder and choose Import.
  3. Select General > File System and click Next.
    Import Source Dialog

  4. For the From directory field click Browse, select the LdapJavaDsp32/lib folder, and click OK.

    Importing the Spring LDAP JAR Files

  5. Click the checkbox next to lib to select all JAR files in the library; then click Finish. The wizard imports the selected JAR files.

Importing the ldap_java.jar File

The ldap_java.jar file contains Java functions for your new physical data service.

To import the ldap_java.jar file:

  1. Right-click the DSP-INF/lib folder and choose Import.
  2. Select General > File System, then Next.
  3. For the From directory field click Browse, select the LdapJavaDsp32/dist folder, and click OK.

    Importing the ldap_java.jar File

  4. Click the checkbox next to dist, then click Finish. The wizard imports the ldap_java.jar file.

Creating the Physical Data Service

You need to create the physical data service that uses Java functions to facilitate data access.

You can inspect the Java functions; they are in the DspLdapWrapper.java file.

To create the physical data service:

  1. In the Project Explorer right-click RetailDataspace/Physical, and choose New > Physical Data Service.

    Creating a New Physical Data Service

  2. Choose Java Function from the Data source type drop-down list.
  3. Click Browse next to the Class name field. The Open Java Class dialog appears.
  4. Navigate to:
    ldap_java/com/example/ldap/DspLdapWrapper.class
  5. Click Open.
    Open Java Class

  6. Click Next.
  7. Select all functions except:
    {{main(java.lang.String)}}
  8. Select the updatePersonSDO() function
  9. Select the With Change Summary checkbox.

    Select Java Function

  10. Click Next.
  11. Configure the settings in the Review New/Updated Data Service Operation(s) step, as shown in the following table:
    Operation Public Kind Primary
    updatePersonXMLBean Yes
    Update
    updatePersonSDO Yes
    Update
    deletePerson Yes
    Delete Yes
    createPerson Yes
    Create Yes
    getPersonByUserId Yes
    Read
    getAllPersons Yes
    Read


    Review New/Updated Data Service Operation(s)

  12. Click Next.
  13. Type a Data Service Name, such as:
    LDAPdsp
  14. Click Finish.

Update the Procedure Declaration 

The procedure declaration generated by the New Physical Data Service Wizard needs to be modified.
This step is a workaround for CR365986 in the import wizard. Once you make these code changes to correctly list inetOrgPerson it will work correctly and will treat the function as a primary update procedure.
 
To update the procedure declaration: 

  1. Double-click the data service in the Project Explorer.
  2. Click the Source tab.
  3. Update the pragma of the updatePersonSDO() procedure to set the operation as primary, as shown in the following:
    <f:function xmlns:f="urn:annotations.ld.bea.com" visibility="public" kind="update" isPrimary="true" nativeName="updatePersonSDO">
  4. Update the declaration for the updatePersonSDO() procedure to match the following (make sure the namespace prefix matches your source):
    declare procedure f1:updatePersonSDO($x1 as changed-element(t1:inetOrgPerson)*) as empty() external;
  5. Choose File > Save from the main menu.
  6. Redeploy the project.

You can now perform create, read, update and delete (CRUD) operations against an LDAP server. For example, in Test view you can run the getAllPersons() operation.

Testing the getAllPersons() LDAP Operation 

You can also optionally create new logical data services that combine this physical data service with other data services, such as RDBMS, Web Services, and so on.

Next Step

Related Topics

Concepts
How Tos

edocs Home > BEA AquaLogic Data Services Platform 3.0/3.2 Documentation > ALDSP 3.2 New Features Documentation

How To Test an LDAP-based Operation

This topic describes how to create a logical data service and add an operation to test a Java-based read operation in the physical data service.

Topic Map

Supporting LDAP Server Entries Through Data Services

Create a New Logical Data Service

The first step is to create a new logical data service that will serve as the container for the operation.

  1. Expand RetailDataspace/Logical, right-click Customer, and choose New > Logical Data Service.

    Choosing New > Logical Data Service

  2. Enter LdapTest as the data service name.

    New Logical Data Service Dialog

  3. Click Browse to select a schema file, expand Logical/Customer/schemas, select Profile.xsd, and click OK.

    New Dataspace Project Dialog

  4. Click Finish. Studio creates the new logical data service.

Creating a Read Operation

After creating the logical data service, you need to add a read operation that uses the Java-based read operation in the physical data service.

  1. In the Overview for the LDAPTest.ds data service, right-click and choose Add Operation.

    Adding a New Operation

  2. Type a name for the new operation, such as getLdapCustomers.
  3. Click OK.

    Adding a New Operation Dialog

  4. Choose File > Save to save the data service.

Defining the Read Operation

The next step is to define the getLdapCustomers read operation to join information returned by the getAllPersons Java-based operation and the getCustomer operation in the Profile data service.

  1. Click the Query Map tab in the LdapTest.ds data service.
  2. Expand RetailDataspace/Physical/LDapdsp.ds, drag the getAllPersons() operation, and drop it in the Query Map.

    Adding the getAllPersons Operation

  3. Expand RetailDataspace/Logical/Customer/Profile.ds, drag the getCustomer operation, and drop it in the Query Map.

    Adding the getCustomer Operation

  4. Create a connection between the userId element in the getAllPersons() operation and the LoginID element in the getCustomer operation by dragging the userId element to the target element.

    Joining the userId and LoginID

  5. Click the Overwrite Mapping button, and drag the PROFILE complex element name in the getCustomer operation to the PROFILE element in the Return type.

    Overwrite Mapping the Porfile to the Return Results

  6. Right-click PROFILE in the Return result and choose Expand Complex Mapping.

    Expanding Complex Mapping

  7. Click the Source tab.
  8. Change the FirstName element of the result to the following:
    {fn:concat('LDAP',fn:data($inetOrgPerson/commonName))}
  9. Choose File > Save to save the data service.

Testing the Java-Based Read Operation

The final step is to run the getLdapCustomers() read operation, which uses the Java-based getAllPersons() read operation in the physical data service.

To test the getLdapCustomers() read operation:

  1. With the LdapTest.ds open, click the Test tab.
  2. Choose getLdapCustomers() from the Select operation drop-down list.
  3. Click Run. Studio runs the operation and displays the results.

    Running the getLdapCustomers Operation

Related Topics

Concepts
How Tos
Document generated by Confluence on Nov 26, 2008 13:06